AddCSLuaFile( "shared.lua" )

include('shared.lua')
function ENT:Initialize()
	self.Entity:SetModel("models/bomb/bomb.mdl")
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	
	local phys = self.Entity:GetPhysicsObject()
	
	if (phys:IsValid()) then
		phys:Wake()
		phys:SetMass(100)
	end
end

function ENT:Touch( ent)  
	local box = false
		for k,v in pairs(ents.FindByClass("sent_bomb")) do
			if(ent == v)then
				box = true
			end
		end
		for k,v in pairs(ents.FindByClass("sent_missle")) do
			if(ent == v)then
				box = true
			end
		end
	if ((ent:IsVehicle()) or (box == true))then
		local explosion = ents.Create( "env_explosion" ) // Creating our explosion
		explosion:SetKeyValue( "spawnflags", 144 ) //Setting the key values of the explosion 
		explosion:SetKeyValue( "iMagnitude", 15 ) // Setting the damage done by the explosion
		explosion:SetKeyValue( "iRadiusOverride", 256 ) // Setting the radius of the explosion 
		explosion:SetPos(self:GetPos()) // Placing the explosion where we are
		explosion:Spawn( ) // Spawning it
		explosion:Fire("explode","",0)
		self.Entity:Remove()
	end  
end